package org.example.controller;


import lombok.extern.slf4j.Slf4j;
import org.example.bean.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

@Slf4j
@Controller
public class HelloController {

    @ResponseBody
    @RequestMapping("/hello")
    public String hello(){
        return  "hello 1934";
    }

    @RequestMapping("/thymeleafdemo")
    public String thymeleafdemo(Map<String, Object> map) {
        //通过 map 向前台页面传递数据
        map.put("name", "贵阳");
        return "hello";
    }

    @RequestMapping("/testjsp")
    public String testjsp(){
        return "jsp/test";//返回 /WEB-INF/jsp/index.jsp 页面(jsp)
    }



////    test
//    @RequestMapping("/user/test")
//    public void test(User user, Map<String, Object> map) {
//        String name = user.getUsername();
//        System.out.println(name);
//        log.info("名字："+ user.getUsername());
//        return ;
//    }

}
